You can use the StandardGetFile procedure to present the standard user interface when the user asks to open a file. If you need to add elements to the default dialog boxes or exercise greater control over user actions in the dialog box, use CustomGetFile .
If your application is designed to execute in system software versions earlier than version 7.0, you can use the corresponding procedures SFGetFile and SFPGetFile .
You can use the StandardGetFile procedure to display the default Open dialog box when the user is opening a file.
PROCEDURE StandardGetFile (fileFilter: FileFilterProcPtr;
numTypes: Integer;
typeList: SFTypeList;
VAR reply: StandardFileReply);
The StandardGetFile procedure presents a dialog box through which the user specifies the name and location of a file to be opened. While the dialog box is active, StandardGetFile gets and handles events until the user completes the interaction, either by selecting a file to open or by canceling the operation. StandardGetFile returns the user's input in a record of type StandardFileReply .
The fileFilter , numTypes , and typeList parameters together determine which files appear in the displayed list. The first filtering is by file type, which you specify in the numTypes and typeList parameters. The numTypes parameter specifies the number of file types to be displayed. You can specify one or more types. If you specify a numTypes value of -1, the first filtering passes files of all types.
The fileFilter parameter points to an optional file filter function, provided by your application, through which StandardGetFile passes files of the specified types. See "Writing a File Filter Function" for a description of the file filter function.
Call the CustomGetFile procedure when your application requires more control over the Open dialog box than is possible using StandardGetFile .
PROCEDURE CustomGetFile (fileFilter: FileFilterYDProcPtr;
numTypes: Integer;
typeList: SFTypeList;
VAR reply: StandardFileReply;
dlgID: Integer;
where: Point;
dlgHook: DlgHookYDProcPtr;
filterProc: ModalFilterYDProcPtr;
activeList: Ptr;
activateProc: ActivateYDProcPtr;
yourDataPtr: UNIV Ptr);
The CustomGetFile procedure is an alternative to StandardGetFile when you want to use a customized dialog box or handle the default Open dialog box in a customized way. CustomGetFile presents a dialog box through which the user specifies the name and location of a file to be opened. While the dialog box is active, CustomGetFile gets and handles events until the user completes the interaction, either by selecting a file to open or by canceling the operation. CustomGetFile returns the user's input in a record of type StandardFileReply .
The first four parameters are similar to the same parameters in StandardGetFile . The fileFilter , numTypes , and typeList parameters determine which files appear in the list of choices. If you specify a value of -1 in the numTypes parameter, CustomGetFile displays or passes to your file filter function all files and folders (not just the files) at the current level of the display hierarchy. If you provide a filter function, CustomGetFile passes it both the pointer to the catalog entry for each file to be processed and also a pointer to the optional data passed by your application in its call to CustomGetFile .
Use the SFGetFile procedure to display the default Open dialog box when the user is opening a file.
PROCEDURE SFGetFile (where: Point; prompt: Str255;
fileFilter: FileFilterProcPtr;
numTypes: Integer; typeList: SFTypeList;
dlgHook: DlgHookProcPtr; VAR reply: SFReply);
The SFGetFile procedure displays a dialog box listing the names of a specific group of files from which the user can select one to be opened (as during an Open menu command). During the dialog, SFGetFile gets and handles events (possibly with the assistance of application-defined callback routines) until the user completes the interaction, either by selecting a file to open or by canceling the open operation. SFGetFile returns the user's input in a record of type SFReply .
Call the SFPGetFile procedure when your application requires more control over the Open dialog box than is possible using SFGetFile .
PROCEDURE SFPGetFile (where: Point; prompt: Str255;
fileFilter: FileFilterProcPtr;
numTypes: Integer; typeList: SFTypeList;
dlgHook: DlgHookProcPtr;
VAR reply: SFReply; dlgID: Integer;
filterProc: ModalFilterProcPtr);
The SFPGetFile procedure is an alternative to SFGetFile when you want to display a customized Open dialog box or handle the default dialog box in a customized way. During the dialog, SFPGetFile gets and handles events (possibly with the assistance of application-defined callback routines) until the user completes the interaction, either by selecting a file to open or by canceling the open operation. SFPGetFile returns the user's input in a record of type SFReply .